package com.stan.core.mapper;

import com.stan.core.vo.AdClickTrend;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * 滑动窗口计算一小时内每分钟各个广告点击流的趋势
 * ( date , hour , minute , aid , clickCount )
 */
@Mapper
public interface AdClickTrendMapper {

    @Insert("insert into t_ad_minute_count (time_minute,aid,click_count) values " +
            " (#{timeToMinute},#{aid},#{clickCount})")
    void insert(AdClickTrend adClickTrend);

    @Select("select time_minute,aid,click_count as clickCount from t_ad_minute_count " +
            "where time_minute=#{timeToMinute} and aid=#{aid} " +
            "limit 1")
    AdClickTrend get(AdClickTrend adClickTrend);


}
